home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 252 < prev    next >
Internet Message Format  |  1996-08-06  |  1KB

  1. Path: sdrc.com!thor!scjones
  2. From: scjones@thor.sdrc.com (Larry Jones)
  3. Newsgroups: comp.std.c
  4. Subject: Re: atexit() and return from main()
  5. Date: 31 Jan 1996 15:58:01 GMT
  6. Organization: SDRC Engineering Services
  7. Distribution: world
  8. Message-ID: <4eo3i9$kbs@info1.sdrc.com>
  9. References: <4dhfja$j50@fg70.rz.uni-karlsruhe.de> <4diicg$i9e@lyra.csx.cam.ac.uk> <4emq9l$2fn@hammy.lonestar.org>
  10. NNTP-Posting-Host: thor.sdrc.com
  11.  
  12. In article <4emq9l$2fn@hammy.lonestar.org>, gordon@hammy.lonestar.org (Gordon Burditt) writes:
  13. > I claim that longjmp()ing out of an atexit function into main
  14. > causes undefined behavior because main() has already returned
  15. > (or, equivalently, called exit()) between the setjmp and
  16. > longjmp calls.
  17. > In fact, calling exit() may not unwind the stack like returning
  18. > from main() does, so you might get away with it, but there's
  19. > no guarantee.
  20.  
  21. Yes there is, sort of.  A forthcoming compendium of Technical
  22. Corrigenda clarifies that returning from main and calling exit are not
  23. *completely* equivalent in that calling exit does *not* unwind the stack
  24. (at least not until so late in the processing that the program can not
  25. tell that it happened).
  26. ----
  27. Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH  45150-2789  513-576-2070
  28. larry.jones@sdrc.com
  29. You just can't ever be too careful. -- Calvin
  30.